<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>扩张运算符的应用</title>
</head>

<body>
  <div class="div"></div>
  <div class="div"></div>
  <div class="div"></div>
  <script>
    /* 
扩展运算符的应用
*/
    //1.数组的合并
    /* let xyj = ["孙悟空", "猪八戒", "沙和尚", "唐僧", "白龙马"];
    let hl = ["贾宝玉", "林黛玉", "薛宝钗"];
    let con=[...xyj,...hl];
    console.log(con); */

    //2.数组的克隆
    let hl = ["贾宝玉", "林黛玉", "薛宝钗"];
    let newHl = [...hl];
    console.log(newHl);

    //3.将伪数组转换为真数组
    let divs = document.querySelectorAll(".div");
    let arrDiv = [...divs];
    console.log(arrDiv);
  </script>
</body>

</html>